<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body id="body">

<div id="container" aria-label="container">

  <table border=1 summary="test" aria-hidden="true">
    <tr><td>cell</td><td>cell</td><td>cell</td></tr>
    <tr><td>cell</td><td>cell</td><td>cell</td></tr>
  </table>

  <div role="grid" aria-hidden="true">
    <div role="row">
      <div role="gridcell">cell</div>
    </div>
  </div>

  <ul aria-hidden="true">
  <li>test
  <li>test
  </ul>

  <div aria-label="wrapper">
    <div role="listbox" aria-hidden="true">
      <div role="option">option</div>
      <div role="option">option</div>
    </div>
  </div>

  <h1>heading</h1>

</div>

<p id="description"></p>
<div id="console"></div>

<script>

    description("This tests that aria-hidden works as expected on elements that are subclasses of AccessibilityRenderObject");

   if (window.accessibilityController) {
      var container = accessibilityController.accessibleElementById("container");
      // first child is a table that has an unignored rowgroup.
      // the rowgroup's child has 0 unignored children.
      var child_1 = container.childAtIndex(0);
      shouldBe("child_1.childrenCount", "1")
      var grandchild_1 = child_1.childAtIndex(0);
      shouldBeTrue("grandchild_1.isIgnored");

      shouldBe("grandchild_1.childrenCount", "2")
      for (let i = 0; i < grandchild_1.childrenCount; ++i) {
        shouldBeTrue("grandchild_1.childAtIndex(" + i + ").isIgnored");
      }

      // second child is a grid that has 0 unignored children
      var child_2 = container.childAtIndex(1);
      for (let i = 0; i < child_2.childrenCount; ++i) {
        shouldBeTrue("child_2.childAtIndex(" + i + ").isIgnored");
      }

      // third child is a list with 0 unignored children
      var child_3 = container.childAtIndex(2);
      shouldBe("child_3.childrenCount", "2")
      for (let i = 0; i < child_3.childrenCount; ++i) {
        shouldBeTrue("child_3.childAtIndex(" + i + ").isIgnored");
      }

      // fourth child is a container with an ignored listbox
      var child_4 = container.childAtIndex(3);
      shouldBe("child_4.childrenCount", "1")
      shouldBe("child_4.role", "'AXRole: AXGenericContainer'");
      shouldBeFalse("child_4.isIgnored");
      shouldBeTrue("child_4.childAtIndex(0).isIgnored");

      // fith child is a heading
      var child_5 = container.childAtIndex(4);
      shouldBeFalse("child_5.isIgnored");
      shouldBe("child_5.role", "'AXRole: AXHeading'");
    }

</script>

</body>
</html>
